<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in" ref="dialogBox">
      <div class="cornerComment-in-title">
        <span>{{
            type == 2 ? '教职工' : '家长'
          }}-{{ pageOption ? (pageOption.student ? pageOption.student.name : pageOption.user.realname) : '' }}-离厦申报</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-form label-width="300px" ref="editForm" v-if="pageOption">
          <el-form-item label="姓名:">
            {{ pageOption.student ? pageOption.student.name : pageOption.user.realname }}
          </el-form-item>
          <el-form-item label="申报日期:">
            {{ pageOption.create_time }}
          </el-form-item>
          <el-form-item label="外出目的地:">
            {{ pageOption.address }}
          </el-form-item>
          <el-form-item label="外出事由:">
            {{ pageOption.reason }}
          </el-form-item>
          <el-form-item label="离厦居住方式:">
            {{ pageOption.live_type==1?'居家':'酒店' }}
          </el-form-item>
          <el-form-item label="离厦日期:">
            {{ pageOption.start_time }}
          </el-form-item>
          <el-form-item label="返厦日期:">
            {{ pageOption.end_time }}
          </el-form-item>
          <el-form-item label="交通工具:">
            {{vehicleList[pageOption.vehicle]}}
          </el-form-item>
          <el-form-item label="中途是否逗留其他城市:">
            {{ pageOption.leaveOther }}
          </el-form-item>
          <el-form-item label="逗留轨迹:">
              <el-table
                  ref="multipleTable"
                  :data="pageOption.list"
                  tooltip-effect="dark"
                  style="width: 100%"
                  border
                  header-cell-class-name="table-text-c"
                  cell-class-name="table-text-c">
                <el-table-column
                    prop="address"
                    label="逗留地址">
                </el-table-column>
                <el-table-column
                    prop="start_time"
                    label="逗留地进入时间"
                    width="160">
                </el-table-column>
                <el-table-column
                    prop="end_time"
                    label="逗留地离开时间">
                </el-table-column>
              </el-table>
          </el-form-item>
        </el-form>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="closePOpup" size="small">确定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {yearDay} from '@/utils/util.js'
import {leaveEdit} from '@/api/admin/trajectory.js'

export default {
  props: ['visible', 'healthId', 'type'], // commoent 学生点评 collection 学生采集
  components: {},
  data() {
    return {
      dialogVisible: false,
      // 页数
      tableHeight: 0,
      pageOption: null,
      vehicleList: {
        1: '自驾',
        2: '动车/火车',
        3: '飞机',
        4: '大巴',
        5: '轮船'
      }
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible;
      if (this.visible) {
        this.InitFn();
      } else {
        this.pageOption = '';
        this.studentPhoto = [];
        this.familyPhoto = [];
        this.tripCode = [];
      }
    }
  },
  created() {
  },
  methods: {
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    // 初始化
    InitFn() {
      leaveEdit({id: this.healthId}).then(res => {
        res.vo.leaveOther = res.vo.list.length?'有':'无'
        this.pageOption = res.vo
      })
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 70%;
  height: 75%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.toolbarLine {
  text-align: center;
}

.hearder-search {
  display: flex;
  align-items: center;
}

.viewerImg {
  width: 100px;
}
</style>


